import { get, post } from '@/libs/request'

/**
 * 获取好友分组列表
 */
const getFriendGroupList = () => get<T_FriendGroup[]>('friend/group/list')

/**
 * 获取好友列表
 */
const getFriendList = (page?: number, size?: number, groupId?: number, keyword?: string) =>
  post<{
    size: number
    page: number
    total: number
    totalPage: number
    hasNext: boolean
    list: T_Friend[]
  }>('friend/list', { page, size, groupId, keyword })

/**
 * 新增好友分组
 * @param groupName 分组名称
 */
const addFriendGroup = (groupName: string) => post('friend/group/add', { groupName })

/**
 * 删除好友
 * @param id 好友ID
 */
const deleteFriend = (id: number) => post('friend/delete', { id })

export { getFriendGroupList, getFriendList, addFriendGroup, deleteFriend }
